package com.fenghuajueli.module_home.recycler

import android.view.View
import com.blankj.utilcode.util.LogUtils

fun View.show() {
    visibility = View.VISIBLE
}

fun View.hide() {
    visibility = View.GONE
}

fun View.invisible() {
    visibility = View.INVISIBLE
}

private var lasTime = 0L
private const val TIME_INTERVER = 300
fun View.setOnFastClickListener(timeInterver:Int = TIME_INTERVER, onClick: (view:View) -> Unit) {
    setOnClickListener {
        val timeDiff = System.currentTimeMillis() - lasTime
        val b = timeDiff <= timeInterver
        if (b) {
            LogUtils.d("是否跳过点击：$b---快速点击时间差：$timeDiff---点击时间间隔：$timeInterver")
            return@setOnClickListener
        }
        lasTime = timeDiff
        onClick.invoke(this)
    }

}